﻿@using HiLand.Utility4.MVC.Controls
@using HiLand.Utility4.MVC.Data
@using HiLand.General.Entity
@using HiLand.Utility.Enums
@using HiLand.Utility.Drawing
@using HiLand.Utility.IO

@model ImageEntity
@{
    this.Layout = null;
    ViewBag.Title = "图片信息";

    string productGuid = this.GetPassedParam("productGuid");
    string returnUrl = this.GetPassedParam("returnUrl");

    bool isMain = false;
    if(Model.ImageIsMain== Logics.True)
    {
        isMain = true;
    }

    bool canUsable = true;
    if(Model.CanUsable== Logics.False)
    {
        canUsable = false;
    }

    string thubnailFullVirtualName = Model.EnsureThumbnailAllVirtualPath(180,135);
}

@using (Html.BeginForm("ImageDetails", "Image", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
    <h2>
        产品信息</h2>
    <table>
        <tr>
            <td>
                图片名称 :
            </td>
            <td>
                @Html.HiTextBox("ImageName").Value(Model.ImageName).Render()
            </td>
            <td rowspan="5">
                @if (string.IsNullOrWhiteSpace(thubnailFullVirtualName) == false)
                { 
                    <img src="@thubnailFullVirtualName" alt="产品图片" />
                }
            </td>
        </tr>
        <tr>
            <td>
                选择图片 :
            </td>
            <td>
                <input type="file" name="fileInput" id="fileInput"/>
            </td>
        </tr>
        <tr>
            <td>
                是否可用:
            </td>
            <td>
                @Html.HiCheckBox("CanUsable").Value(Model.CanUsable).IsChecked(canUsable).Render()
            </td>
        </tr>
        <tr>
            <td>
                是否为主图片 :
            </td>
            <td>
                @Html.HiCheckBox("ImageIsMain").Value(Model.ImageIsMain).IsChecked(isMain).Render()
            </td>
        </tr>
        <tr>
            <td>
                排列序号 :
            </td>
            <td>
                @Html.HiTextBox("ImageOrder").Value(Model.ImageOrder).Render()
            </td>
        </tr>
        <tr>
            <td>
                图片描述:
            </td>
            <td colspan="3">
                @Html.HiTextArea("ImageDescription").Value(Model.ImageDescription).Render()
            </td>
        </tr>
        
    </table>
    <input type="hidden" class="RelativeGuid" name="RelativeGuid" id="RelativeGuid"  value="@productGuid" />
    <input type="hidden" class="ImageGuid" name="ImageGuid" id="ImageGuid"  value="@Model.ImageGuid" />
    <input type="hidden" class="returnUrl" name="returnUrl" id="returnUrl"  value="@returnUrl" />
    <br />
    <input type="submit" value="Save" class="btnSave" name="btnSave" />
}

